import 'package:get/get.dart';

extension ExGetx on GetInterface {
  S? findOrNull<S>({String? tag}) {
    if (Get.isRegistered<S>(tag: tag)) {
      return Get.find<S>(tag: tag);
    } else {
      return null;
    }
  }
}

extension ExGetWidget<T extends GetxController> on GetWidget<T> {
  // 添加扩展字段：ctrl getter，返回 controller
  T get ctrl => controller;
}

extension ExGetView<T extends GetxController> on GetView<T> {
  // 添加扩展字段：ctrl getter，返回 controller
  T get ctrl => controller;
}
